package com.suli.account.service.serviceImpl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.suli.account.entity.Article;
import com.suli.account.entity.UserTicket;
import com.suli.account.enums.ArticleType;
import com.suli.account.enums.TicketStatus;
import com.suli.account.mapper.ArticleMapper;
import com.suli.account.service.ArticleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author SuLi
 * @since 2022-04-14
 */
@Service
public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> implements ArticleService {

    @Autowired
    ArticleMapper articleMapper;

    @Override
    public Map<String, Object> getArticleCountByType(String articleType) {
        QueryWrapper<Article> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("article_type", ArticleType.valueOf(articleType));
        Long aLong = articleMapper.selectCount(queryWrapper);
        Map<String,Object> map=new HashMap<>();
        map.put("AllCount", aLong);
        return map;
    }
}
